//
//  TL_BannerCollectionViewCell.m
//  WXReader
//
//  Created by Andrew on 2021/9/14.
//  Copyright © 2021 Andrew. All rights reserved.
//

#import "TL_BannerCollectionViewCell.h"

@implementation TL_BannerCollectionViewCell
{
    TL_ProductionCoverView *bannerImageView;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    bannerImageView = [[TL_ProductionCoverView alloc] initWithProductionType:TL_ProductionTypeBook productionCoverDirection:TL_ProductionCoverDirectionVertical];
    [self.contentView addSubview:bannerImageView];
    
    [bannerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kHalfMargin);
        make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kHalfMargin);
        make.top.mas_equalTo(self.contentView.mas_top);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];
}

- (void)setBannerModel:(TL_ActionModel *)bannerModel
{
    _bannerModel = bannerModel;
    
    
    
    [bannerImageView.productionImageView setImageWithURL:[NSURL URLWithString:bannerModel.cover?:@""] placeholder:kEmptyHoldImage];
}
- (void)setBannerWithUrl:(NSString *)urlStr{
    
    [bannerImageView.productionImageView setImageWithURL:[NSURL URLWithString:urlStr] placeholder:kEmptyHoldImage];
}

@end
